/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package RDA;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author Raúl Delgado & Xavi Pol
 */
public class NaveBase extends Entidad {

    float vidaNave;
    float vidaTotalNave;
    Disparo disparo;
    Image nave;
    Image explosion;

    /**
     * Constructor
     */
    public NaveBase(float vidaNave, float vidaTotalNave, Disparo disparo, Image nave, Image explosion) {
        this.vidaNave = vidaNave;
        this.vidaTotalNave = vidaTotalNave;
        this.disparo = disparo;
        this.nave = nave;
        this.explosion = explosion;
    }

    @Override
    public void posicion(float x, float y) {
        super.x = x;
        super.y = y;
        super.s = new Rectangle(x, y, nave.getWidth(), nave.getHeight());
        disparo.posicion(x , y);
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sb, int delta) {
    }

    @Override
    public void render(GameContainer gc, Graphics g) {
    }


    public void impacte(float dany) {
        if (vidaNave > 0.0) {
            vidaNave -= dany;
        }
        if (vidaNave <= 0.0) {
            destruido = true;
        }
    }

    public Disparo getDisparo() {
        return disparo.clonarDisparo();
    }

    public Image getNave() {
        return nave;
    }

    public void setNave(Image nave) {
        this.nave = nave;
    }

    public float getVidaNave() {
        return vidaNave;
    }

    public void setVidaNave(float vidaNave) {
        this.vidaNave = vidaNave;
    }

    public float getVidaTotalNave() {
        return vidaTotalNave;
    }

    public void setVidaTotalNave(float vidaTotalNave) {
        this.vidaTotalNave = vidaTotalNave;
    }
    
}
